package io.renren.modules.back.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;
import io.renren.modules.back.dao.GoodsIssueDao;
import io.renren.modules.back.entity.GoodsIssueEntity;
import io.renren.modules.back.service.GoodsIssueService;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * 商品问答Service接口实现类
 *
 * @author zzh
 * @email 862583291@qq.com
 * @date 2019年02月01日 上午15:28:55
 */
@Service("goodsIssueService")
public class GoodsIssueServiceImpl extends ServiceImpl<GoodsIssueDao, GoodsIssueEntity> implements GoodsIssueService {
  @Override
  public PageUtils queryPage(Map<String, Object> params) {
    String question = (String)params.get("question");
    Page<GoodsIssueEntity> page = (Page<GoodsIssueEntity>) this.page(
        new Query<GoodsIssueEntity>(params).getPage(),
        new QueryWrapper<GoodsIssueEntity>()
            .like(StringUtils.isNotBlank(question),"question", question)
    );
    return new PageUtils(page);
  }
}
